/**
* 左边菜单
*/ 
<template>
  <el-menu default-active="2" :collapse="collapsed" collapse-transition router :default-active="$route.path" unique-opened class="el-menu-vertical-demo" background-color="#334157" text-color="#fff" active-text-color="#ffd04b">
    <div class="logobox">
      <img class="logoimg" src="../assets/img/logo.png" alt="">
      <span v-if="!collapsed">免费车管理系统</span>
    </div>
    <el-submenu v-for="menu in allmenu" :key="menu.menuid" :index="menu.menuname">
      <template slot="title">
        <i class="iconfont" :class="menu.icon"></i>
        <span>{{menu.menuname}}</span>
      </template>
      <el-menu-item-group>
        <el-menu-item v-for="chmenu in menu.menus" :index="'/'+chmenu.url" :key="chmenu.menuid">
          <i class="iconfont" :class="chmenu.icon"></i>
          <span>{{chmenu.menuname}}</span>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>
<script>
export default {
  name: 'leftnav',
  data() {
    return {
      collapsed: false,
      allmenu: []
    }
  },
  // 创建完毕状态(里面是操作)
  created() {
    // 获取图形验证码
    let res = {
      success: true,
      data: [
        {
          menuid: 1,
          icon: 'li-icon-gongsiguanli',
          menuname: '菜单导航',
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 11,
              // icon: 'icon-cat-skuBasic',
              menuname: '详细信息查询',
              hasThird: 'N',
              url: 'search/Search',
              menus: null
            },{
              menuid: 12,
              // icon: 'icon-cat-skuQuery',
              menuname: '申请车辆录入信息',
              hasThird: 'N',
              url: 'addInfo/AddExcelInfo',
              menus: null
            }, {
              menuid: 13,
              // icon: 'icon-cat-skuQuery',
              menuname: '汇总信息查询',
              hasThird: 'N',
              url: 'satistics/Satistics',
              menus: null
            },{
              menuid: 14,
              // icon: 'icon-cat-skuQuery',
              menuname: '统计信息查询',
              hasThird: 'N',
              url: 'satistics/TotalSearch',
              menus: null
            },
            /*{
              menuid: 13,
              // icon: 'icon-cat-skuQuery',
              menuname: '申办单存档',
              hasThird: 'N',
              url: 'applyImgSave/ApplyImgSave',
              menus: null
            },{
              menuid: 14,
              // icon: 'icon-cat-skuQuery',
              menuname: '批办单存档',
              hasThird: 'N',
              url: 'approImgSave/ApproImgSave',
              menus: null
            },{
              menuid: 15,
              // icon: 'icon-cat-skuQuery',
              menuname: '速通反馈存档',
              hasThird: 'N',
              url: 'feedImgSave/FeedImgSave',
              menus: null
            }*/
          ]
        },
        /*{
          menuid: 2,
          icon: 'li-icon-xitongguanli',
          menuname: '参数维护',
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 21,
              // icon: 'icon-cat-skuQuery',
              menuname: '车辆类型维护',
              hasThird: 'N',
              url: 'manager/carType',
              menus: null
            }
          ]
        }*/
       /* {
          menuid: 2,
          icon: 'li-icon-xitongguanli',
          menuname: '参数维护',
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 21,
              // icon: 'icon-cat-skuQuery',
              menuname: '车辆类型维护',
              hasThird: 'N',
              url: 'manager/carType',
              menus: null
            },{
              menuid: 22,
              // icon: 'icon-cat-skuQuery',
              menuname: '路类型维护',
              hasThird: 'N',
              url: 'manager/roadType',
              menus: null
            },{
              menuid: 23,
              // icon: 'icon-cat-skuQuery',
              menuname: '业务类型维护',
              hasThird: 'N',
              url: 'manager/carBussType',
              menus: null
            },
          ]
        },*/
      ],
      msg: 'success'
    }
          this.allmenu = res.data
    // 监听
    this.$root.Bus.$on('toggle', value => {
      this.collapsed = !value
    })
  }
}
</script>
<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 240px;
  min-height: 400px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}
.el-menu-item-group__title {
  padding: 0px;
}
.el-menu-bg {
  background-color: #1f2d3d !important;
}
.el-menu {
  border: none;
}
.logobox {
  height: 60px;
  line-height: 40px;
  color: #9d9d9d;
  font-size: 20px;
  text-align: center;
  padding: 20px 0px;
}
.logoimg {
  height: 25px;
}
</style>
